package cn.cloud.all.security.access.event;

import cn.cloud.all.security.access.ConfigAttribute;
import cn.cloud.all.security.core.Authentication;

import java.util.Collection;

public class AuthorizedEvent extends AbstractAuthorizationEvent {

    private Authentication authentication;
    private Collection<ConfigAttribute> configAttributes;

    public AuthorizedEvent(Object secureObject, Collection<ConfigAttribute> attributes, Authentication authentication) {
        super(secureObject);

        if ((attributes == null) || (authentication == null)) {
            throw new IllegalArgumentException("All parameters are required and cannot be null");
        }

        this.configAttributes = attributes;
        this.authentication = authentication;
    }

    public Authentication getAuthentication() {
        return authentication;
    }

    public Collection<ConfigAttribute> getConfigAttributes() {
        return configAttributes;
    }
}
